package com.glsc.ngateway.common.base.domain.mysql.gateway.platform;

import com.glsc.ngateway.common.base.domain.mysql.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * @author xuchang
 */
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@Entity
@Where(clause = "deleted = 0")
@SQLDelete(sql = "update t_gw_owncloud_operate_log set deleted = UNIX_TIMESTAMP(NOW()), handled = 0 where id=?")
@SQLDeleteAll(sql = "update t_gw_owncloud_operate_log set deleted = UNIX_TIMESTAMP(NOW()), handled = 0 where id=?")
@Table(name = "t_gw_owncloud_operate_log")
public class OwnCloudOperateLog extends BaseEntity {
    private static final long serialVersionUID = -3115083465120636750L;
    @Column(name = "operator", columnDefinition = "varchar(128) not null comment '操作人'")
    private String operator;

    @Column(name = "type", columnDefinition = "varchar(32) not null comment '操作类型'")
    private String type;

    @Column(name = "logInfo", columnDefinition = "text not null comment '日志内容'")
    private String logInfo;

    @Column(name = "result", columnDefinition = "varchar(256) not null comment '操作结果'")
    private String result;

    @Column(name = "errInfo", columnDefinition = "text comment '失败信息'")
    private String errInfo;
}
